#include "Rectangle.h"
#include <iostream>
using namespace std;


Rectangle::Rectangle()
{
    // 无参构造
    this->height = 0;
    this->width = 0;
}

Rectangle::Rectangle(int x, int y, int w, int h):co(x, y)
{
    // 有参构造
    this->height = h;
    this->width = w;
}

Rectangle::Rectangle(const Rectangle &ob)
{
    // 拷贝构造
    this->co = ob.co;
    this->height = ob.height;
    this->width = ob.width;
}

Rectangle::~Rectangle()
{
    // 析构函数

}

void Rectangle::setWidth(int w)
{
    this->width = w;
    return;
}

void Rectangle::setHeight(int h)
{
    this->height = h;
    return;
}

int Rectangle::GetWidth(void)
{
    return this->width;
}

int Rectangle::GetHeight(void)
{
    return this->height;
}

int Rectangle::GetX(void)
{
    return this->co.getX();
}
int Rectangle::GetY(void)
{
    return this->co.getY();
}

int Rectangle::area(void)
{
    return this->GetHeight() * this->GetWidth();
}

void Rectangle::dispInfo(void)
{
    cout << "X = " << this->GetX() << endl;
    cout << "Y = " << this->GetY() << endl;
    cout << "h = " << this->GetHeight() << endl;
    cout << "w = " << this->GetWidth() << endl;
    return;
}